package com.hankol.community.adapter

import android.widget.RelativeLayout
import androidx.recyclerview.widget.RecyclerView
import com.baselibrary.bean.ReleaseTopicBean
import com.baselibrary.utils.ScreenUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hankol.community.R

/**
 */
class HotTopicAdapter : BaseQuickAdapter<List<ReleaseTopicBean.DataBean>, BaseViewHolder>(R.layout.item_hot_topic) {
    override fun convert(helper: BaseViewHolder, bean: List<ReleaseTopicBean.DataBean>) {
        val root = helper.getView<RelativeLayout>(R.id.rl_root)
        val p = root.layoutParams
        p.width = (ScreenUtils.getScreenWidth() - ScreenUtils.dpToPx(41))
        p.height = (ScreenUtils.dpToPx((80 + 20) * 3))
        root.layoutParams = p
        val adapter = HotTopicChildAdapter()
        helper.getView<RecyclerView>(R.id.rv_hot_topic_child).adapter = adapter
        adapter.setNewData(bean)
    }

}